<?php
include $this->Render('header.php');
?>
<link rel="stylesheet" type="text/css" href="<?php echo BASE_STYLE;?>/css/admin.css" />
<script type="text/javascript" src="<?php echo BASE_STYLE;?>/js/dyhl.linkpage.js"></script>
<script type="text/javascript" src="<?php echo BASE_STYLE;?>/js/common.js"></script>

<div class="tongrong-box" style="width:450px;">
	<form class="login-box-form J-ajaxForm" action="/auth/getpwd/option/submit" method="post" autocomplete="off">
	<div class="tongrong-box-main">
    	<table width="100%" cellpadding="0" cellspacing="0" border="0">
        	<tr>
            	<td width="90px" height="30">用户手机号：</td>
                <td>
                	<?php echo $this->member_info['u_mobile'];?>
                    <input type="hidden" value="<?php echo $this->member_info['u_mobile'];?>" class="J-username" name="u_name" />
                </td>
            </tr>
            
            <tr>
            	<td height="30">验证码：</td>
                <td>
                	<input name="u_code" type="text" id="u_code"  value="" />&nbsp;&nbsp;
                    <input type="button" class="J-getcode" style="background:#adc4d6; border:none; padding:3px 12px; font-size:12px; color:#FFF;" onClick="sendMessage()" value="获取验证码">
                </td>
            </tr>
            <tr>
            	<td height="30">新密码：</td>
                <td>
                	<input name="u_repassword" style="background:none;" type="password" id="u_repassword" value="" />
                </td>
            </tr> 
        </table>
    </div>
    <div class="luru-box-btn mt30">
    	<input class="btn-submit-blue fn-left mr15 J-submit" type="submit" value="提交" />
        <a class="a-btn-close J-a-btn-close" href="javascript:;">关闭</a>
    </div>
	</form>
</div>

<script>
	//关闭弹出
	$(".J-a-btn-close").on('click',function(){
		var winElement = parent.Ext.fly(window.frameElement).up('div.x-window');
		parent.Ext.getCmp(winElement.id).close();
	});
	
	$(document).ready(function(e) {
		//获取验证码
		
        $(".J-submit").on('click',function(){
			$(this).dyhlForm({
				beforefunction:function(){
					$(".J-submit").prop('disabled',true);
				},
				nofunction:function(){
					$(".J-submit").prop('disabled',false);
				},
				sucessfunction:function(data){
					$(".J-submit").prop('disabled',false);
					if(data['success']){
						Ext.Msg.alert('提示','提交成功',function(){
							window.parent.App.store.reload();
							var winElement = parent.Ext.fly(window.frameElement).up('div.x-window');
							parent.Ext.getCmp(winElement.id).close();
						});
					}else{
						Ext.Msg.alert('提示',data['msg']);
					}
				}	
			});	
		});
    });
	
</script>
<script type="text/javascript">
/*-------------------------------------------*/
var InterValObj; //timer变量，控制时间
var count = 60; //间隔函数，1秒执行
var curCount;//当前剩余秒数
var code = ""; //验证码
var codeLength = 6;//验证码长度
function sendMessage() {
	curCount = count;
	var phone=$(".J-username").val();//手机号码
	if(phone != ""){
		
		jQuery(".J-getcode").attr("disabled", "true");
		jQuery(".J-getcode").val(curCount + "秒后重新获取");
		InterValObj = window.setInterval(SetRemainTime, 1000); //启动计时器，1秒执行一次
		
		$.post('/public/ajax/option/sendsms/',{'mobile':phone},function(data){
			if(data.success){
				return false
			}else{
				//alert(data.msg);
				Ext.Msg.alert('提示',data['msg']);
			}
		},'json');
	}else{
		//alert("手机号码不能为空！");
		Ext.Msg.alert('提示','手机号码不能为空!');
	}
}
//timer处理函数
function SetRemainTime() {
	if (curCount == 0) {                
		window.clearInterval(InterValObj);//停止计时器
		jQuery(".J-getcode").removeAttr("disabled");//启用按钮
		jQuery(".J-getcode").val("重新发送验证码");
		code = ""; //清除验证码。如果不清除，过时间后，输入收到的验证码依然有效    
	}
	else {
		curCount--;
		jQuery(".J-getcode").val(curCount + "秒后重新获取");
	}
}
</script>

<?php include $this->Render('footer.php'); ?>